package com.zxw.controller;

import com.aaa.entity.GBrand;
import com.aaa.vo.Result;
import com.zxw.service.GBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ：zxw
 * @date ：Created in 2023/2/28 15:18
 */
@RestController
@RequestMapping("/goods/brand")
@SuppressWarnings("all")
public class GBrandController {
    @Autowired
    private GBrandService gBrandService;

    //连表分页加模糊查询所有品牌
    @RequestMapping("/findAllBrand")
    public Result findAllBrand(@RequestBody GBrand gBrand,
                               @RequestParam(defaultValue = "1" ) Integer pageCurrent,
                               @RequestParam(defaultValue = "5") Integer pageSize){
        Result allBrands = gBrandService.findAllBrands(gBrand, pageCurrent, pageSize);
        return allBrands;
    }

    //删除品牌
    @RequestMapping("/delete")
    public Result delete(Integer id){
        return gBrandService.deleteBrand(id);
    }

    //审核品牌
    @RequestMapping("/update")
    public Result update(@RequestBody GBrand gBrand){
        return gBrandService.updateBrand(gBrand);
    }
}
